import { lazy } from "react";
import { buildRoutes, RouteConfig } from "./utils";
import { createBrowserRouter } from "react-router";

const routeConfig: RouteConfig[] = [
  {
    path: "/",
    element: lazy(() => import("@/views/login/Index")),
  },
  {
    path: "/login",
    element: lazy(() => import("@/views/login/Index")),
  },
  {
    path: "/home",
    element: lazy(() => import("@/views/home/Index")),
    children: [
      {
        index: true,
        element: lazy(() => import("@/views/onePage/Index")),
      },
      {
        path: "/home/twoPage",
        element: lazy(() => import("@/views/twoPage/Index")),
      },
      {
        path: "/home/threePage",
        element: lazy(() => import("@/views/threePage/Index")),
      },
    ],
  },
];

export const routes = buildRoutes(routeConfig);

export const router = createBrowserRouter(routes);
